/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mbos.entities;

import mbos.entities.enums.OrderStatus;
import mbos.entities.enums.PaymentStatus;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

/**
 *
 * @author mier
 */
@Entity
@Table
public class Orders implements Serializable {
  private static final long serialVersionUID = 1l;
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Column(name="id")
  private Integer id;
  @NotNull
  @Column(name="table_no")
  private Integer tableNo;
  @NotNull
  @Column(name="date_ordered")
  @Temporal(TemporalType.TIMESTAMP)
  private Date dateOrdered;
  @JoinColumn(name="customer_id", referencedColumnName = "id")
  @ManyToOne(optional = false)
  private Customer customerId;
  @JoinColumn(name = "cashier", referencedColumnName = "id", nullable = false)
  @ManyToOne(optional = false)
  private Account cashier;
  @JoinColumn(name = "crew", referencedColumnName = "id", nullable = false)
  @ManyToOne(optional = false)
  private Account crew;
  @NotNull
  @Column(name="money_received")
  private double moneyReceived;
  @NotNull
  @Column(name="total")
  private double total;
  @NotNull
  @Enumerated(EnumType.STRING)
  @Column(name="order_status")
  private OrderStatus orderStatus;
  @NotNull
  @Enumerated(EnumType.STRING)
  @Column(name="payment_status")
  private PaymentStatus paymentStatus;
  @Column(name="dflg")
  private short dflg;
  @OneToMany(mappedBy = "orderId")
  public List<OrderDetails> orderDetails;
  
  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public Integer getTableNo() {
    return tableNo;
  }

  public void setTableNo(Integer tableNo) {
    this.tableNo = tableNo;
  }

  public Date getDateOrdered() {
    return dateOrdered;
  }

  public void setDateOrdered(Date dateOrdered) {
    this.dateOrdered = dateOrdered;
  }

  public Customer getCustomerId() {
    return customerId;
  }

  public void setCustomerId(Customer customerId) {
    this.customerId = customerId;
  }

  
  public Account getCashier() {
    return cashier;
  }

  public void setCashier(Account cashier) {
    this.cashier = cashier;
  }

  public Account getCrew() {
    return crew;
  }

  public void setCrew(Account crew) {
    this.crew = crew;
  }

  public double getMoneyReceived() {
    return moneyReceived;
  }

  public void setMoneyReceived(double moneyReceived) {
    this.moneyReceived = moneyReceived;
  }

  public double getTotal() {
    return total;
  }

  public void setTotal(double total) {
    this.total = total;
  }

  public OrderStatus getOrderStatus() {
    return orderStatus;
  }

  public void setOrderStatus(OrderStatus orderStatus) {
    this.orderStatus = orderStatus;
  }

  public PaymentStatus getPaymentStatus() {
    return paymentStatus;
  }

  public void setPaymentStatus(PaymentStatus paymentStatus) {
    this.paymentStatus = paymentStatus;
  }

  public short getDflg() {
    return dflg;
  }

  public void setDflg(short dflg) {
    this.dflg = dflg;
  }

  public List<OrderDetails> getOrderDetails() {
    return orderDetails;
  }

  public void setOrderDetails(List<OrderDetails> orderDetails) {
    this.orderDetails = orderDetails;
  }
   
  
}
